﻿<local:MyPage 
    x:Class="RingSong.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:local="clr-namespace:RingSong"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768" 
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait"  Orientation="Portrait"
    shell:SystemTray.IsVisible="True">
    <local:MyPage.Resources>
        <DataTemplate x:Key="DataTemplate1">
            <Grid>
                <TextBlock Text="{Binding}" HorizontalAlignment="Right" Height="159" VerticalAlignment="Bottom" Margin="0,0,-578,-198" FontSize="120" Foreground="#FFFB8302"/>
                <Image Height="144" VerticalAlignment="Bottom" Source="Images/logo.png" Margin="-8,0,-90,-198"/>
            </Grid>
        </DataTemplate>
        <DataTemplate x:Key="DataTemplate2">
            <Grid Height="77" Width="328">
                <TextBlock Margin="0,-16,54,0" FontSize="50" TextWrapping="Wrap" Text="{Binding}" Foreground="#FF5E483A"/>
            </Grid>
        </DataTemplate>
        <DataTemplate x:Key="DataTemplate3">
            <StackPanel Margin="0,0,0,17" Width="412">
                <Grid Width="425">
                    <TextBlock Text="{Binding Title}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}" Canvas.Left="43" Margin="48,0,20,0" Foreground="Black" FontSize="26.667" Canvas.Top="1"/>
                    <TextBlock TextWrapping="Wrap"  Canvas.Top="9" Width="44" Foreground="#FF898989" FontSize="21.333" TextAlignment="Right" HorizontalAlignment="Left" Margin="0,5"><Run Text="{Binding Tag,Mode=OneTime}" /><Run Text="." /></TextBlock>
                </Grid>
                <Grid Margin="0" RenderTransformOrigin="0.5,0.5">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="0.045*"/>
                        <ColumnDefinition Width="0.24*"/>
                        <ColumnDefinition Width="0.715*"/>
                    </Grid.ColumnDefinitions>
                    <TextBlock TextWrapping="Wrap" Margin="29,0,-67,0" Style="{StaticResource PhoneTextSubtleStyle}" Foreground="#FF898989" Grid.Column="1"><Run Text="下载："/><Run Text="{Binding Totaldown}" /></TextBlock>
                    <TextBlock Grid.Column="2" Margin="71,0,8,0" TextWrapping="Wrap" FontSize="20" Foreground="#FF898989" Text="{Binding Singer}" TextAlignment="Right"/>
                </Grid>
            </StackPanel>
        </DataTemplate>
        <Style x:Key="ButtonStyle2" TargetType="Button">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Grid x:Name="grid" Background="#FFA88157">
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualState x:Name="Disabled"/>
                                    <VisualState x:Name="Normal"/>
                                    <VisualState x:Name="MouseOver">
                                        <Storyboard>
                                            <ColorAnimation Duration="0" To="White" Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)" Storyboard.TargetName="grid" d:IsOptimized="True"/>
                                            <ColorAnimation Duration="0" To="Black" Storyboard.TargetProperty="(TextBlock.Foreground).(SolidColorBrush.Color)" Storyboard.TargetName="textBlock" d:IsOptimized="True"/>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Pressed">
                                        <Storyboard>
                                            <ColorAnimation Duration="0" To="White" Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)" Storyboard.TargetName="grid" d:IsOptimized="True"/>
                                            <ColorAnimation Duration="0" To="Black" Storyboard.TargetProperty="(TextBlock.Foreground).(SolidColorBrush.Color)" Storyboard.TargetName="textBlock" d:IsOptimized="True"/>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <TextBlock x:Name="textBlock" TextWrapping="Wrap" Text="{TemplateBinding Content}" TextAlignment="Center"/>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>


        <DataTemplate x:Key="DataTemplate4">
            <StackPanel Margin="0,0,0,17" Name="pan" Width="412">

                <toolkit:ContextMenuService.ContextMenu>
                    <toolkit:ContextMenu Name="contextMenu" toolkit:TiltEffect.IsTiltEnabled="True"  IsZoomEnabled="False">
                        <toolkit:MenuItem Header="重新下载" Click="MenuItem_Click" Tag="{Binding}" />
                        <toolkit:MenuItem Header="删除" Click="MenuItem_Click" Tag="{Binding}" />
                    </toolkit:ContextMenu>
                </toolkit:ContextMenuService.ContextMenu>
                <Grid>
                    <TextBlock Text="{Binding Title}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}" Canvas.Left="43" Margin="48,0,0,0" Foreground="Black" FontSize="26.667" Canvas.Top="1"/>
                    <TextBlock TextWrapping="Wrap"  Canvas.Top="9" Width="44" Foreground="#FF898989" FontSize="21.333" TextAlignment="Right" HorizontalAlignment="Left" Margin="0,5"><Run Text="{Binding Tag}" /><Run Text="." /></TextBlock>
                </Grid>
                <Grid Name="grd" Margin="0,-14,0,0" Tag="{Binding Infoid}" RenderTransformOrigin="0.5,0.5" Height="0">
                    <Grid.RenderTransform>
                        <CompositeTransform/>
                    </Grid.RenderTransform>
                    <Grid x:Name="pro" Margin="37,0,9,5" VerticalAlignment="Top" Visibility="Collapsed">
                        <ProgressBar Name="proBar" Background="#FFFEA203" Value="{Binding Progress}" d:LayoutOverrides="Width" Maximum="100" Foreground="#FFFEA203"/>
                    </Grid>
                    <Grid x:Name="btns" VerticalAlignment="Top" Height="41" Margin="0,15,0,0">
                        <Button Name="btn_Play" toolkit:TiltEffect.IsTiltEnabled="True" Click="Btn_Play"  Content="播放" HorizontalAlignment="Left" Style="{StaticResource ButtonStyle2}" Width="93" Margin="48,0,0,0"/>
                        <Button Name="btn_Del" toolkit:TiltEffect.IsTiltEnabled="True" Click="Btn_Del"   Content="删除" Style="{StaticResource ButtonStyle2}" Margin="168,0,146,0"/>
                        <Button Name="btn_Set" toolkit:TiltEffect.IsTiltEnabled="True" Click="Btn_Set"   Content="设为铃声" Style="{StaticResource ButtonStyle2}" Margin="0,0,8,0" HorizontalAlignment="Right" Width="111"/>
                    </Grid>
                    <Grid x:Name="wait" VerticalAlignment="Top" Height="20" Margin="0,13,0,0">
                        <TextBlock Margin="0,0,18,0" TextWrapping="Wrap" Text="等待中..." TextAlignment="Right" Foreground="#FF5E483A" FontSize="16" HorizontalAlignment="Right" Width="124" Height="20"/>
                    </Grid>
                </Grid>
                <toolkit:GestureService.GestureListener>
                    <toolkit:GestureListener Hold="list_Hold"  />
                </toolkit:GestureService.GestureListener>
            </StackPanel>
        </DataTemplate>
        <Style x:Key="ButtonStyle1" TargetType="Button">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Grid>
                            <Image Source="Images/search.png" Stretch="Fill"/>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <ItemsPanelTemplate x:Key="ItemsPanelTemplate1">
            <toolkit:WrapPanel  Orientation="Horizontal" />
        </ItemsPanelTemplate>
        <Style x:Key="ButtonStyle3" TargetType="Button">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Canvas>
                            <Image Source="{Binding Tag, RelativeSource={RelativeSource TemplatedParent}}" Height="170" Width="170"/>
                            <Grid Height="35" Canvas.Top="135" Width="170" Background="#57000000">
                                <TextBlock Margin="0,1,8,0" TextWrapping="Wrap" TextAlignment="Right" Text="{TemplateBinding Content}" Foreground="White"/>
                            </Grid>
                        </Canvas>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Storyboard x:Name="Storyboard1">
            <DoubleAnimation Duration="0:0:0.4" To="0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="listBox" d:IsOptimized="True"/>
            <DoubleAnimation Duration="0:0:0.4" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="BtnBack" d:IsOptimized="True"/>
        </Storyboard>
        <Style x:Key="ButtonStyle4" TargetType="Button">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Canvas Background="#FFA88157">
                            <TextBlock TextWrapping="Wrap" Text="{TemplateBinding Content}" Canvas.Top="8" Width="121" TextAlignment="Center"/>
                        </Canvas>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Storyboard x:Name="Storyboard2">
            <DoubleAnimation Duration="0:0:0.4" To="0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="BtnBack" d:IsOptimized="True"/>
        </Storyboard>
    </local:MyPage.Resources>

    <!--LayoutRoot 是包含所有页面内容的根网格-->
    <Grid x:Name="LayoutRoot" Background="Transparent" >
        <!--Panorama 控件-->
        <controls:Panorama Name="pan" Title="微格铃声" TitleTemplate="{StaticResource DataTemplate1}"
                           HeaderTemplate="{StaticResource DataTemplate2}"
                           SelectionChanged="Panorama_SelectionChanged">
            <controls:Panorama.Background>
                <ImageBrush ImageSource="PanoramaBackground.jpg"/>
            </controls:Panorama.Background>
            <!--Panorama 项目一-->
            <controls:PanoramaItem Header="最热"  Height="588" Width="424" Margin="0,180,0,0">
                <!--具有文字环绕的双线列表-->
                <ListBox x:Name="list1" toolkit:TiltEffect.IsTiltEnabled="True" Margin="0,-47,0,0" ItemsSource="{Binding Items}"
                         ItemTemplate="{StaticResource DataTemplate3}" SelectionChanged="list1_SelectionChanged" />
            </controls:PanoramaItem>

            <!--Panorama 项目一-->
            <controls:PanoramaItem Header="最新" Height="588" Width="424" Margin="0,180,0,0">
                <!--具有文字环绕的双线列表-->
                <ListBox x:Name="list2"  SelectionChanged="list1_SelectionChanged"  toolkit:TiltEffect.IsTiltEnabled="True" Margin="0,-47,0,0" ItemsSource="{Binding Items2}"
                         ItemTemplate="{StaticResource DataTemplate3}" />
            </controls:PanoramaItem>
            <controls:PanoramaItem Header="搜索" Height="588" Width="424" Margin="0,180,0,0">
                <!--具有文字环绕的双线列表-->
                <Grid Margin="0,-44,0,0">
                    <!--具有文字环绕的双线列表-->
                    <ListBox SelectionChanged="list1_SelectionChanged" x:Name="list3" toolkit:TiltEffect.IsTiltEnabled="True" Margin="0,79,0,0" d:LayoutOverrides="GridBox"
                             ItemsSource="{Binding Items3}" ItemTemplate="{StaticResource DataTemplate3}"/>
                    <TextBox x:Name="txt" TextWrapping="Wrap" Background="#A9DCD6AF" BorderBrush="{x:Null}" Height="75" BorderThickness="0" FontSize="29.333" Margin="-1,0,86,0" VerticalAlignment="Top" d:LayoutOverrides="GridBox" SelectionForeground="White" SelectionBackground="#FFDCD6AF"/>
                    <Button Content="Button" Click="Button_Click"  HorizontalAlignment="Right" Height="58" Margin="0,8,8,0" Style="{StaticResource ButtonStyle1}" VerticalAlignment="Top" Width="58" d:LayoutOverrides="GridBox"/>
                    <TextBlock TextWrapping="Wrap" Name="searchFail" Text="" VerticalAlignment="Top" Margin="8,79,0,0" FontSize="20" Foreground="#FF898989" HorizontalAlignment="Left" Visibility="Collapsed" />

                </Grid>
            </controls:PanoramaItem>
            <controls:PanoramaItem Header="下载历史" Height="588" Width="424" Margin="0,180,0,0">
                <!--具有文字环绕的双线列表-->
                <Grid Margin="0,-44,0,0">
                    <!--具有文字环绕的双线列表-->
                    <ListBox x:Name="list4" toolkit:TiltEffect.IsTiltEnabled="True" d:LayoutOverrides="GridBox"
            		ItemsSource="{Binding Items4}"  SelectionChanged="list4_SelectionChanged"
                    ItemTemplate="{StaticResource DataTemplate4}" Margin="0" >

                    </ListBox>
                    <MediaElement Name="media" />
                </Grid>
            </controls:PanoramaItem>
            <controls:PanoramaItem x:Name="pan5" Header="分类" Height="588" Width="424" Margin="0,180,0,0">
                <!--具有文字环绕的双线列表-->
                <Grid Margin="0,-44,0,0">
                    <!--具有文字环绕的双线列表-->
                    <ListBox x:Name="listBox" toolkit:TiltEffect.IsTiltEnabled="True"
					d:LayoutOverrides="GridBox"
                    Margin="0" ItemsPanel="{StaticResource ItemsPanelTemplate1}" >
                        <Button Content="日韩" Tag="/Images/fl_1.jpg" CommandParameter="3" Click="BtnType_Click" Height="170" Style="{StaticResource ButtonStyle3}" Width="170"/>
                        <Button Content="搞笑" Tag="/Images/fl_2.jpg" CommandParameter="4" Click="BtnType_Click" Height="170" Style="{StaticResource ButtonStyle3}" Width="170" Margin="20,0,0,0"/>
                        <Button Content="欧美" Tag="/Images/fl_3.jpg" CommandParameter="8" Click="BtnType_Click" Height="170" Style="{StaticResource ButtonStyle3}" Width="170" Margin="0,20,0,0"/>
                        <Button Content="华语" Tag="/Images/fl_4.jpg" CommandParameter="9" Click="BtnType_Click" Height="170" Style="{StaticResource ButtonStyle3}" Width="170" Margin="20,20,0,0"/>
                        <Button Content="舞曲" Tag="/Images/fl_5.jpg" CommandParameter="13" Click="BtnType_Click" Height="170" Style="{StaticResource ButtonStyle3}" Width="170" Margin="0,20,0,0"/>
                        <Button Content="影视" Tag="/Images/fl_6.jpg" CommandParameter="16" Click="BtnType_Click" Height="170" Style="{StaticResource ButtonStyle3}" Width="170" Margin="20,20,0,0"/>
                        <Button Content="游戏" Tag="/Images/fl_7.jpg" CommandParameter="17" Click="BtnType_Click" Height="170" Style="{StaticResource ButtonStyle3}" Width="170" Margin="0,20,0,0"/>
                        <Button Content="流行" Tag="/Images/fl_8.jpg" CommandParameter="20" Click="BtnType_Click" Height="170" Style="{StaticResource ButtonStyle3}" Width="170" Margin="20,20,0,0"/>
                        <Button Content="乐器" Tag="/Images/fl_9.jpg" CommandParameter="21" Click="BtnType_Click" Height="170" Style="{StaticResource ButtonStyle3}" Width="170" Margin="0,20,0,0"/>
                        <Button Content="其他" Tag="/Images/fl_10.jpg" CommandParameter="22" Click="BtnType_Click" Height="170" Style="{StaticResource ButtonStyle3}" Width="170" Margin="20,20,0,0"/>
                        <Button Content="短信" Tag="/Images/fl_11.jpg" CommandParameter="24" Click="BtnType_Click" Height="170" Style="{StaticResource ButtonStyle3}" Width="170" Margin="0,20,0,0"/>
                        <Button Content="来电" Tag="/Images/fl_12.jpg" CommandParameter="25" Click="BtnType_Click" Height="170" Style="{StaticResource ButtonStyle3}" Width="170" Margin="20,20,0,0"/>
                        <Button Content="闹铃" Tag="/Images/fl_13.jpg" CommandParameter="26" Click="BtnType_Click" Height="170" Style="{StaticResource ButtonStyle3}" Width="170" Margin="0,20,0,0"/>
                        <Button Content="特效" Tag="/Images/fl_14.jpg" CommandParameter="27" Click="BtnType_Click" Height="170" Style="{StaticResource ButtonStyle3}" Width="170" Margin="20,20,0,0"/>
                        <Button Content="个性" Tag="/Images/fl_15.jpg" CommandParameter="28" Click="BtnType_Click" Height="170" Style="{StaticResource ButtonStyle3}" Width="170" Margin="0,20,0,0"/>

                    </ListBox>
                    <Button x:Name="BtnBack" Style="{StaticResource ButtonStyle2}"  Click="BtnBack_Click" Content="返回" HorizontalAlignment="Right" Opacity="0" VerticalAlignment="Top" Width="103" Height="34" Margin="0,-56,10,0"/>
                    <ListBox toolkit:TiltEffect.IsTiltEnabled="True" SelectionChanged="list1_SelectionChanged" 
                             Name="list5" ItemTemplate="{StaticResource DataTemplate3}" ItemsSource="{Binding Items5}" 
                             Visibility="Collapsed" />
                    <TextBlock x:Name="typeFail" TextWrapping="Wrap" Text="暂无记录，请返回。" VerticalAlignment="Top" Foreground="#FF898989" Margin="113,18,119,0" d:LayoutOverrides="Width" Visibility="Collapsed"/>
                </Grid>
            </controls:PanoramaItem>
            <controls:PanoramaItem Header="关于" Height="588" Width="424" Margin="0,180,0,0">
            	<Grid Margin="0,-54,0,8">
            		<TextBlock HorizontalAlignment="Left" Margin="8,34,0,231" TextWrapping="Wrap" Foreground="#FF5E483A" Width="396" UseLayoutRounding="True" FontSize="26.667"><Run Text="微格铃声是乐讯旗下微格网推出的针对Windows Phone手机铃声管理软件。"/><LineBreak/><Run Text="您可以安全便捷的下载自己喜欢的铃声，设置为手机来电铃声，方便快捷，是您手机必备的软件。"/></TextBlock>
            		<TextBlock HorizontalAlignment="Left" Margin="10,0,0,165" TextWrapping="Wrap" Foreground="#FF5E483A" Width="359" UseLayoutRounding="True" FontSize="20" Height="32" VerticalAlignment="Bottom" Text="更多Windows phone应用请访问："/>
            		<HyperlinkButton Content="www.wpgo.cn" Margin="-1,0,0,134" VerticalAlignment="Bottom" Foreground="#FF0800FF" Click="HyperlinkButton_Click" HorizontalAlignment="Left"/>
            		<TextBlock TextWrapping="Wrap" x:Name="searchFail_Copy" Margin="10,0,0,7" FontSize="16" Foreground="#FF898989" HorizontalAlignment="Left" VerticalAlignment="Bottom" Text="版权所有： 粤ICP备09011165号-8" />
            		<TextBlock TextWrapping="Wrap" x:Name="searchFail_Copy1" Margin="10,0,0,31" FontSize="16" Foreground="#FF898989" HorizontalAlignment="Left" VerticalAlignment="Bottom" ><Run Text="Copyright(C)"/><Run Text=" "/><Run Text="1996-2012 lexun, All Rights Reserved "/></TextBlock>
            	</Grid>
            </controls:PanoramaItem>

            <!--Panorama 项目二-->
            <!--使用“Orientation="Horizontal"”可使面板水平放置-->
        </controls:Panorama>
    </Grid>
</local:MyPage>